<template>
  <div class="result-list-box">
    <p class="tab">
      <span>氢能行业政策</span>
    </p>
    <ul class="result-list">
      <li v-for="(item, index) in resultList" :key="index">
        <a class="title" :title="item.title" :href="item.link" target="_blank">{{item.title}}</a>
        <p class="abst" v-html="item.abst"></p>
        <div class="footer">
          <p>{{item.source}}&nbsp;&nbsp;{{item.date}}</p>
          <p class="btn-p">
            <span class="tag" v-for="(ite, j) in item.tagArr" :key="j">{{ite}}</span>
            <!-- <span class="sentiment" :class="{normal: item.sentiment==='正面', neutral: item.sentiment==='中性', negative: item.sentiment==='负面'}">{{item.sentiment}}</span> -->
          </p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import {dynamicData} from './dynamicData.js'
export default {
  data() {
    return {
      resultList: []
    }
  },
  methods: {
    init() {
      this.resultList = dynamicData
    }
  },
  mounted() {
    this.init()
  }
}
</script>

<style lang="scss" scoped>
.tab {
  position: relative;
  margin-top: 20px;
  margin-left: 20px;
  text-align: left;
  span {
    display: inline-block;
    line-height: 30px;
    padding: 0 10px;
    border: 1px solid #7578ee;
    border-radius: 2px;
    margin-right: 14px;
    text-align: center;
    font-size: 14px;
    color: #7775da;
    cursor: pointer;
    &:hover, &.active {
      color: #fff;
      background-color: #7775da;
    }
  }
}
.result-list {
  position: relative;
  width: 100%;
  padding: 0 24px;
  /* border-top: 1px solid #a9a7e8; */
  text-align: left;
  list-style: none;
  background-color: #fff;
  li {
    display: block;
    padding: 10px;
    border-bottom: 1px solid #d4d3f3;
    &:last-of-type {
      border-bottom: 0;
    }
    &:hover {
      // background-color: #f3f3fe;
      .btn-p {
        .tag {
          color: #fff;
          background-color: #7578ee;
        }
        .normal {
          color: #fff;
          background-color: #41b3a2;
        }
        .neutral {
          color: #fff;
          background-color: #efa752;
        }
        .negative {
          color: #fff;
          background-color: #d96f6f;
        }
      }
    }
    .title {
      display: inline-block;
      padding: 14px 0;
      border-bottom: 0;
      text-decoration: none;
      font-weight: 600;
      font-size: 14px !important;
      color: #241c75;
    }
    .abst {
      line-height: 26px;
      margin-bottom: 16px;
      font-size: 14px;
      color: #7674a3;
    }
    .footer {
      position: relative;
      p {
        margin-bottom: 0;
        &:nth-child(1) {
          font-size: 14px;
          color: #b8c2d7;
        }

      }
    }
  }
  .btn-p {
    position: absolute;
    top: -10px;
    right: 0;
    span {
      display: inline-block;
      height: 28px;
      line-height: 28px;
      padding: 0 10px;
      border-radius: 4px;
      margin-right: 10px;
      font-size: 14px;
      color: #7775da;
      background-color: #ececf4;
    }
  }
}

.btn-p span.sentiment.normal {
  color: #41b3a2;
  background-color: #e4f6f3;
}
.btn-p span.sentiment.neutral {
  color: #efa752;
  background-color: #fef0df;
}
.btn-p span.sentiment.negative {
  color: #d96f6f;
  background-color: #f8e8e8;
}
</style>